#include <REGX52.H>
#include <intrins.h>
void Delay(unsigned int xms)		//@11.0592MHz
{
	while(xms--)
	{
		unsigned char i, j;

		_nop_();
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}
}
unsigned char p;
void main()
{
	P2=0x01;
	while(1)
	{
		if(P3_1==0)
		{
			Delay(20);
			while(P3_1==0)
			Delay(20);
			p++;
			p>=8;
			p=0;
			P2=~(0x01<<p);
		}
		if(P3_0==0)
		{
			Delay(20);
			while(P3_0==0)
			Delay(20);
			
			if(p==0)
				p=7;
			else p--;
			P2=~(0x01<<p);
		}
			
			
	}


}	


